//
//  HomeCell.m
//  digitalCurrency
//
//  Created by 默认账户 on 2019/4/3.
//  Copyright © 2019 XinHuoKeJi. All rights reserved.
//

#import "HomeCell.h"

@implementation HomeCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self makeviews];
        self.selectionStyle  = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor blackColor];
    }
    return self;
}

- (void)makeviews {
    
    __weak typeof(self)weakself = self;
    
    CGFloat viewwidth = SCREEN_WIDTH - 30;
    
    UIView *bgview = [[UIView alloc] initWithFrame:CGRectMake(15, 5, viewwidth, 100)];
    bgview.backgroundColor    = [UIColor whiteColor];
    bgview.layer.cornerRadius = 8;
    [self addSubview:bgview];
    
    UIImageView *imgview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@""]];
    imgview.backgroundColor    = [UIColor redColor];
    imgview.layer.cornerRadius = 12;
    [bgview addSubview:imgview];
    [imgview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(15);
        make.width.height.mas_equalTo(24);
    }];
    self.headimgview = imgview;
    
    UILabel *bigName = [[UILabel alloc] init];
    bigName.text = @"USTD";
    bigName.font = [UIFont systemFontOfSize:15];
    bigName.textColor = [UIColor blackColor];
    [bgview addSubview:bigName];
    self.bigNameLable = bigName;
    [bigName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imgview.mas_right).mas_offset(6);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(15);
    }];
    
    UILabel *smallName  = [[UILabel alloc] init];
    smallName.text      = @"ustd";
    smallName.font      = [UIFont systemFontOfSize:11];
    smallName.textColor = [UIColor blackColor];
    [bgview addSubview:smallName];
    self.smallNameLable = smallName;
    [smallName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imgview.mas_right).mas_offset(6);
        make.top.mas_equalTo(weakself.bigNameLable.mas_bottom).mas_offset(6);
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(15);
    }];
    
    UILabel *coinCount = [[UILabel alloc] init];
    coinCount.text = @"0.0";
    coinCount.font = [UIFont systemFontOfSize:18];
    coinCount.textColor = [UIColor blackColor];
    [bgview addSubview:coinCount];
    //coinCount.textAlignment = NSTextAlignmentCenter;
    self.coinCountLabel = coinCount;
    [coinCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(45);
        make.top.mas_equalTo(65);
        make.width.mas_equalTo(viewwidth/2.0);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *yncCount = [[UILabel alloc] init];
    yncCount.text = @"≈￥ 0.0";
    yncCount.font = [UIFont systemFontOfSize:11];
    yncCount.textColor = [UIColor blackColor];
    [bgview addSubview:yncCount];
    yncCount.textAlignment = NSTextAlignmentCenter;
    self.yncCountLabel = yncCount;
    [yncCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(viewwidth/2.0);
        make.top.mas_equalTo(65);
        make.width.mas_equalTo(viewwidth/2.0);
        make.height.mas_equalTo(20);
    }];
    
}

@end
